varying vec3 n; varying vec4 p;
void main() {
  /* compute unit normal, vertex position, light vector and
     view vector in viewing coordinates */
  n = normalize(gl_NormalMatrix*gl_Normal);
  p = gl_ModelViewMatrix*gl_Vertex;
  vec3 l = normalize(gl_LightSource[0].position – p.xyz);
  vec3 v = -normalize(p);		/* eye is at origin */
  /* compute halfway vector */
  vec3 h = normalize(l + v);
  /* initialize color with reflection of ambient light */
  frontColor = gl_FrontMaterial.ambient*gl_LightSource[0].ambient;
  /* f indicates if vertex faces light (f=1) or on dark side (f=0) */
  float f = (dot(n,l) > 0.0) ? 1.0 : 0.0;
  /* add Lambertian diffuse reflection of direct light */
  frontColor += f*dot(n,l)*gl_FrontMaterial.diffuse*gl_LightSource[0].diffuse;
  /* add Blinn specular reflection of direct light */
  frontColor += f*pow(dot(n,h),gl_FrontMaterial.shininess) *
		       gl_FrontMaterial.specular*gl_LightSource[0].specular;
  gl_Position = gl_ModelViewProjectionMatrix*gl_Vertex;
}
